package com.wzh.design.flyweight.demo1;

/**
 * @description: 享元模式
 * @author: WZH
 * @time: 2021/6/21 16:40
 */
public class ConcreteFlyweight implements Flyweight {
    private Character intrinsicState = null;

    public ConcreteFlyweight(Character intrinsicState) {
        this.intrinsicState = intrinsicState;
    }

    /**
     * 外蕴状态作为参数传入方法中，改变方法的行为
     * 但是并不改变方法的内蕴状态
     */

    @Override
    public void operation(String state) {
        System.out.println("Intrinsic State = " + this.intrinsicState);
        System.out.println("Extrinsic State = " + state);
    }
}